{% extends "base.html" %}

{% block title %}欢迎使用图床系统{% endblock %}

{% block content %}
<div class="container">
    <div class="hero-section fade-in-up">
        <div class="float-animation">
            <h1 class="display-4 fw-bold mb-4">
                <i class="bi bi-cloud-upload-fill me-3"></i>
                图床系统
            </h1>
        </div>
        <p class="lead mb-4 pulse-animation">安全、快速、易用的图片存储与分享平台</p>
        {% if not current_user.is_authenticated %}
            <a href="{{ url_for('login') }}" class="btn btn-primary btn-lg px-5 py-3">
                <i class="bi bi-box-arrow-in-right me-2"></i>立即开始
            </a>
        {% else %}
            <div class="d-flex justify-content-center gap-3 flex-wrap">
                {% if current_user.role == 'admin' %}
                    <a href="{{ url_for('admin_dashboard') }}" class="btn btn-primary btn-lg px-4 py-3">
                        <i class="bi bi-speedometer2 me-2"></i>管理面板
                    </a>
                {% endif %}
                <a href="{{ url_for('user_gallery') }}" class="btn btn-outline-light btn-lg px-4 py-3">
                    <i class="bi bi-images me-2"></i>图片库
                </a>
            </div>
        {% endif %}
    </div>

    <div class="row mt-5">
        <div class="col-md-4 mb-4">
            <div class="feature-card fade-in-up">
                <div class="feature-icon">
                    <i class="bi bi-shield-check"></i>
                </div>
                <h4 class="mb-3">安全可靠</h4>
                <p class="mb-0">采用多层安全防护，支持用户权限管理，确保您的图片资源安全无忧</p>
            </div>
        </div>
        <div class="col-md-4 mb-4">
            <div class="feature-card fade-in-up" style="animation-delay: 0.2s;">
                <div class="feature-icon">
                    <i class="bi bi-lightning-charge"></i>
                </div>
                <h4 class="mb-3">极速上传</h4>
                <p class="mb-0">支持拖拽批量上传，智能压缩与缩略图生成，让您的工作效率翻倍</p>
            </div>
        </div>
        <div class="col-md-4 mb-4">
            <div class="feature-card fade-in-up" style="animation-delay: 0.4s;">
                <div class="feature-icon">
                    <i class="bi bi-gear"></i>
                </div>
                <h4 class="mb-3">智能管理</h4>
                <p class="mb-0">现代化管理界面，支持搜索筛选、批量操作，让图片管理变得简单</p>
            </div>
        </div>
    </div>

    {% if current_user.is_authenticated %}
    <div class="row mt-5">
        <div class="col-12">
            <div class="card slide-in-left">
                <div class="card-body text-center py-4">
                    <div class="row align-items-center">
                        <div class="col-md-8">
                            <h5 class="card-title mb-2">欢迎回来，{{ current_user.username }}！</h5>
                            <p class="card-text text-muted mb-0">
                                您当前的身份是：
                                <span class="badge bg-primary ms-2">
                                    <i class="bi bi-person-circle me-1"></i>
                                    {% if current_user.role == 'admin' %}管理员{% else %}普通用户{% endif %}
                                </span>
                            </p>
                        </div>
                        <div class="col-md-4 mt-3 mt-md-0">
                            <div class="d-flex justify-content-center gap-2">
                                {% if current_user.role == 'admin' %}
                                    <a href="{{ url_for('admin_dashboard') }}" class="btn btn-primary btn-sm">
                                        <i class="bi bi-speedometer2 me-1"></i>管理
                                    </a>
                                {% endif %}
                                <a href="{{ url_for('user_gallery') }}" class="btn btn-outline-primary btn-sm">
                                    <i class="bi bi-images me-1"></i>浏览
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    {% else %}
    <div class="row mt-5">
        <div class="col-12">
            <div class="card slide-in-left">
                <div class="card-header text-center">
                    <h5 class="mb-0">
                        <i class="bi bi-info-circle me-2"></i>快速开始
                    </h5>
                </div>
                <div class="card-body">
                    <div class="row text-center">
                        <div class="col-md-6">
                            <div class="p-3">
                                <div class="bg-primary text-white rounded-circle d-inline-flex align-items-center justify-content-center mb-3" style="width: 60px; height: 60px;">
                                    <i class="bi bi-person-gear fs-4"></i>
                                </div>
                                <h6 class="fw-bold">管理员账号</h6>
                                <p class="text-muted mb-2">用户名: <code>admin</code></p>
                                <p class="text-muted">密码: <code>admin123</code></p>
                                <small class="text-success">• 上传管理图片</small><br>
                                <small class="text-success">• 查看统计信息</small>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="p-3">
                                <div class="bg-secondary text-white rounded-circle d-inline-flex align-items-center justify-content-center mb-3" style="width: 60px; height: 60px;">
                                    <i class="bi bi-person fs-4"></i>
                                </div>
                                <h6 class="fw-bold">普通用户账号</h6>
                                <p class="text-muted mb-2">用户名: <code>user</code></p>
                                <p class="text-muted">密码: <code>user123</code></p>
                                <small class="text-info">• 浏览图片库</small><br>
                                <small class="text-info">• 查看图片详情</small>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    {% endif %}
</div>
{% endblock %}
